<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="renderer" content="webkit">
    <title></title>
    <link rel="stylesheet" href="<%=request.getContextPath()%>/css/pintuer.css">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/css/admin.css">
    <script src="<%=request.getContextPath()%>/js/jquery.js"></script>
    <script src="<%=request.getContextPath()%>/js/pintuer.js"></script>
</head>
<body>
<form method="post" action="ClassesServlet?action=query" id="listform">
    <div class="panel admin-panel">
        <div class="panel-head"><strong class="icon-reorder"> 用户列表</strong> <a href="" style="float:right; display:none;">添加字段</a></div>
        <div class="padding border-bottom">
            <ul class="search" style="padding-left:10px;">
                <li> <a class="button border-main icon-plus-square-o" href="ClassesServlet?action=add"> 添加班级</a> </li>
                <li>搜索：</li>

                <li>
                    <input type="text" placeholder="请输入搜索班级班号" name="classID" class="input" style="width:250px; line-height:17px;display:inline-block" />
                    <input type="text" placeholder="请输入搜索班级名称" name="className" class="input" style="width:250px; line-height:17px;display:inline-block" />
                    <a href="javascript:void(0)" class="button border-main icon-search" onclick="changeSearch()" > 搜索</a></li>
            </ul>
        </div>
        <table class="table table-hover text-center">
            <tr>
                <th>班级ID</th>
                <th>班级名称</th>
                <th>所属学院</th>
                <th>专业</th>
                <th>年级</th>
                <th>操作</th>
            </tr>
            <%--使用JSTL标签库的迭代标签输出userlist集合的元素--%>
            <c:forEach var="listClasses" items="${requestScope.listClasses}" >
                <tr>
                    <td>${listClasses.classID}</td>
                    <td>${listClasses.className}</td>
                    <td>${listClasses.depID}</td>
                    <td>${listClasses.major}</td>
                    <th>${listClasses.grade}</th>
                    <td><div class="button-group">
                        <c:choose>
                            <c:when test="${item.type==1}">
                                <a class="button border-main" href="javascript:alert('不能修改管理员！')"><span class="icon-edit"></span> 修改</a>
                            </c:when>
                            <c:otherwise>
                                <a class="button border-main" href="ClassesServlet?action=edit&classID=${listClasses.classID}"><span class="icon-edit"></span> 修改</a>
                            </c:otherwise>

                        </c:choose>
                        <c:choose>
                            <c:when test="${item.type==1}">
                                <a class="button border-red" href="javascript:alert('不能删除管理员！')" ><span class="icon-trash-o"></span> 删除</a>
                            </c:when>
                            <c:otherwise>
                                <a class="button border-red" href="ClassesServlet?action=delete&classID=${listClasses.classID}" ><span class="icon-trash-o"></span> 删除</a>
                            </c:otherwise>
                        </c:choose>
                    </div></td>
                </tr>
            </c:forEach>
        </table>

        </div>
</form>
<script type="text/javascript">
    function changeSearch(){
        $("#listform").submit();
    }
</script>
</body>
</html>
